package com.itheima.array;

import java.util.Scanner;

//输入五个50~100内的整数求和

public class ArrTest01 {
    public static void main(String[] args) {
        int[] arr = new int[5];
        int sum = 0;
        System.out.print("请输入第1个整数:");
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = sc.nextInt();
            if (arr[i] < 50 || arr[i] > 100) {
                System.out.print("请重新输入第" + (i + 1) + "个整数:");
                i--;
                continue;
            }
            sum += arr[i];
            if(i <= 3){
                System.out.print("请输入第" + (i + 2) + "个整数:");
            }else {
            }
        }
        System.out.println("sum = " + sum);
    }
}
